function brendClick(e) {
    if (typeof(link) !='undefined') {
        var content = $('div#__mainContentContainer');
        var coords = content.offset();
        var bannerCoords = $('.banner_head').offset();
        var bannerW = Number($('.banner_head').css('width').replace(/\D+/g,""));
        var bannerH = Number($('.banner_head').css('width').replace(/\D+/g,""));
        var w = Number(content.css('width').replace(/\D+/g,""));
        var h = Number(content.css('height').replace(/\D+/g,""));
        
        if( e.pageX < coords.left || w + coords.left < e.pageX || e.pageY < coords.top || coords.top + h < e.pageY ) {
            if(e.pageX < bannerCoords.left || e.pageX > bannerCoords.left + bannerW || e.pageY > bannerCoords.top + bannerH) 
                window.open(link);
        }
    }
}
$(document).ready(function() {
    $('.masthead').click(function(e) {
        brendClick(e);
    });
});
